<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/plugins/jqgrid/ui.jqgrid.css?0820" rel="stylesheet">
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link rel="stylesheet" href="__STATIC__/layout/css/zTreeStyle.css" type="text/css">
</head>

<body style="color:#333;padding:3px;">
    <!-- 标题 -->
    <div class="page-heade">
        <h2 class="title_color text-center">所属网点销售目标导入</h2>
    </div>
    <!-- 标题 -->
    <!-- 筛选 -->
     <form method="post" class="form-horizontal" enctype="multipart/form-data" id="f1">
     <input type="hidden" name="type" id="type"/>
    <div class="container-fluid margin-10">
        <div class="row">
            <label class="col-sm-2 text-right">主题<em style="color:red">*</em>：</label>
            <div class="col-sm-10">
                <input type="text" id="title" name="title" value="" class="form-control" placeholder="">
            </div>
            <div class="hr-line-dashed col-sm-12"></div>
            <label class="col-sm-2 text-right">财年<em style="color:red">*</em>：</label>
            <div class="col-sm-10">
            <!--财年的value为格式id-->
                <select class="form-control" name="fid" id="fid">
                   {volist name="cfarr" id="vo"}
                   	<option value="{$vo.id}">{$vo.title}</option>
                   {/volist}
                </select>
            </div>
            <div class="hr-line-dashed col-sm-12"></div>
            <label class="col-sm-2 text-right">选择导入文件<em style="color:red">*</em>：</label>
            <div class="col-sm-10">
                <input type="button" class="btn btn-w-m btn-info" id="dr" value="导入数据"/>
                  		<input type="file" name="wenjian" id="drfile" style="display: none;"/>
               		
                 		<span id="ts"></span>
            </div>
        </div>
    </div>
    <div class="container-fluid margin-10">
     <div class="txt_con">
       <em>温馨提示：如果导入过程中出现未满足销路通系统要求数据，则整份导入资料都将无法导入，必须按照销路通系统给出的信息提示修改导入资料后再重新导入。 </em><br>
       <b>Excel文件导入注意事项： </b>
       <p>
         1.请仔细阅读下面的市场费用预算数据导入格式。并按照注意事项填入正确的数据。 <br>2.若设置一级考核期，则一级考核期不能为空，且必须是系统中已存在的一级考核期。 <br>3.若设置二级考核期，则二级考核期不能为空，且必须是系统中已存在的二级考核期。 <br>4.若设置品牌，则品牌不能为空，且必须是系统中已存在的品牌。 <br>5.若设置品类，则品类不能为空，且必须是系统中已存在的品类。 <br>6.若设置系列，则系列不能为空，且必须是系统中已存在的品系列。 <br>7.若设置SKU，则SKU不能为空，且必须是系统中已存在的SKU。 <br>8.若设置单品，则单品不能为空，且必须是系统中已存在的单品。 
       </p>
       <p><b>Excel文件导入格式：</b> <a href="javascript:;" id="fidget">网点目标导入格式.xls</a>  <em>注：Excel中标记为红色底色的列为必填项。</em></p>
     </div>
    </div>
    <div class="margin-10 text-center col-sm-12">
        <div class="container-fluid text-center">
               <input class="btn btn-w-m btn-warning" type="button" id="caogao" value="保存为草稿">
                <input class="btn btn-w-m btn-primary" type="button" id="tijiao" value="保存并提交流程">
               <input class="btn btn-w-m btn-danger" type="button"  onclick="history.back()" value="返回">
              </div>
    </div>
    </form>
    <!-- 筛选 -->
    <!-- 全局js -->
    <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <!-- <script src="js/plugins/layer/layer.min.js"></script> -->
    <!-- 自定义js -->
    <!-- <script src="js/hplus.js?v=4.1.0"></script> -->
    <!-- <script type="text/javascript" src="js/contabs.js"></script> -->
    <!-- Peity -->
    <script src="__STATIC__/layout/js/plugins/peity/jquery.peity.min.js"></script>
    <!-- jqGrid -->
    <script src="__STATIC__/layout/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
    <script src="__STATIC__/layout/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>
    <!-- 自定义js -->
    <script src="__STATIC__/layout/js/content.js?v=1.0.0"></script>
    <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
    <!-- ztree -->
    <script type="__STATIC__/layout/text/javascript" src="js/jquery.ztree.core.js"></script>
    <script type="__STATIC__/layout/text/javascript" src="js/jquery.ztree.excheck.js"></script>
    <!-- <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> -->
    <!--统计代码，可删除-->
    <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
    <script type="text/javascript">
    $("#fidget").click(function(){
    	location.href="{:url('Xitongexcel/wangdian')}?fid="+$("#fid").val();
    })
     //上传文件处理
        $("#dr").click(function(){
        	$("#drfile").trigger("click");
        })
        $("#drfile").change(function(){
        	$("#ts").html($(this).val());
        })
        //提交处理
        $("#caogao").click(function(){
        	//保存类型设为草稿
        	$("#type").val(1);
        	go_submits();
        })
        $("#tijiao").click(function(){
        	//保存类型设为草稿
        	$("#type").val(3);
        	go_submits();
        })

          function go_submits(){
        	 var formData = new FormData($('#f1')[0]);  
		     $.ajax({    
		          url: '{:url("Wangdian/new_add")}' ,  /*这是处理文件上传的servlet*/  
		          type: 'POST',    
		          data: formData,   
		          cache: false,    
		         contentType: false,  
          		processData: false,  
		          success: function (re) {  
		          //alert(re);  
		             if(re!=""){
		           	var jieguo=JSON.parse(re);
		            	if(jieguo["state"]==1){
		            		swal({
							title: "完成",
							text:  jieguo["msg"],
							type: "success"
							},function(){
								$("#title").val("");
								$("#drfile").val("");
								$("#ts").html("");
                                location.href='{:url("allapmanage")}'
							});
		            	}else{
		            	swal({
						title: "错误",
						text:  jieguo["msg"],
						type: "warning"
						});
		            	}
		            	
		            }else{
		            	 swal({
						title: "错误",
						text:  "系统繁忙请稍后再试",
						type: "warning"
						});
		            }
		          },    
		          error: function (re) {  
		          //alert(re);  
		              swal({
						title: "错误",
						text:  "系统繁忙请稍后再试",
						type: "warning"
						});
		          }    
		     });    
        }
    </script>
</body>

</html>